package com.zpark.resume.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @PackageName: com.zpark.resume.interceptor
 * @ClassName: MemberNotLoginInterceptor
 * @Description:会员未登录拦截器
 * @author: RZS
 * @date: 2023/6/8  17:17
 */
public class MemberNotLoginInterceptor implements HandlerInterceptor {

    // 拦截方法，自定义拦截规则
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        // 获取session对象
//        HttpSession session = request.getSession();
//        // 从session对象当中获取当前登录会员信息
//        Object member = session.getAttribute("member");
//        // 判断会员是否登录
//        if (member == null) {
//            // 未登录，则拦截到登录页面
//            response.sendRedirect("http://localhost:8888/resume/index.html");
//            return false;
//        }

        // 放行
        return true;
    }

}
